<%-- 
    Document   : AuditFile
    Created on : Oct 26, 2014, 11:51:54 AM
    Author     : user
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="newpackage.ConnectionFactory"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body background="image.jpg">
        <h1> ENSURING PRIVACY AND DATA FRESHNESS OF SHARED DATA IN CLOUD </h1>
        <center>
      <%!
    ArrayList<Map<String,String>> listValues()throws Exception
      {
      ArrayList<Map<String,String>> table=new ArrayList<Map<String,String>>();
        Connection con=ConnectionFactory.getConnection();
        Statement s=con.createStatement();
        String query="Select * from file_details";
        ResultSet rs=s.executeQuery(query);
        while(rs.next())
        {
            Map<String,String> values=new HashMap<String,String>();
            values.put("owner", rs.getString("owner"));
            values.put("filename", rs.getString("filename"));
            values.put("private_key", rs.getString("private_key"));
            values.put("public_key", rs.getString("public_key"));
            values.put("secret_key", rs.getString("secret_key"));
            values.put("split1", rs.getString("split1"));
            values.put("split2", rs.getString("split2"));
            values.put("split3", rs.getString("split3"));
               table.add(values);
        }
        
        return table;
      }
%>
      <%
ArrayList<Map<String,String>> table=listValues();
  out.print("<table>");
  out.print("<th>");out.print("owner"); out.print("</th>");
   out.print("<th>");out.print("filename"); out.print("</th>");
    out.print("<th>");out.print("private_key"); out.print("</th>");
     out.print("<th>");out.print("public_key"); out.print("</th>");
      out.print("<th>");out.print("secret_key"); out.print("</th>"); 
      out.print("<th>");out.print("split1"); out.print("</th>");
       out.print("<th>");out.print("split2"); out.print("</th>");
        out.print("<th>");out.print("split3"); out.print("</th>");
    
      
for(Map<String,String> m:table)     
 {
  
    out.print("<tr>");
    out.print("<td>");  out.print(m.get("owner")); out.print("</td>");
    out.print("<td>");  out.print(m.get("filename").substring(m.get("filename").lastIndexOf('/') + 1)); out.print("</td>");
    out.print("<td>");  out.print(m.get("private_key")); out.print("</td>");
    out.print("<td>");  out.print(m.get("public_key")); out.print("</td>");
    out.print("<td>");  out.print(m.get("secret_key")); out.print("</td>");
    out.print("<td>");  out.print(m.get("split1")); out.print("</td>");
    out.print("<td>");  out.print(m.get("split2")); out.print("</td>");
    out.print("<td>");  out.print(m.get("split3")); out.print("</td>");
    out.print("</tr>");
    
}
out.print("</table>");
%>

</center>
    </body>
</html>
